<?php use_helper('I18N') ?>

<?php if ( $sf_user->hasFlash('object') ): ?>
<div class="box_relief green">
  <p>Votre message a été envoyé avec succès.</p>
  <p>Votre demande sera traitée prochainement, un email vous sera envoyée afin de vous tenir informé.</p>
</div>
<?php echo link_to('Retour à l\'accueil', '@localized_homepage', array('class' => 'box_relief dark_blue')) ?>
<?php else: ?>

  <?php foreach($form as $field => $f): ?>
    <?php $attributes[$field] = array() ?>
  <?php endforeach ?>

  <?php if ($form->hasErrors() && sfConfig::get('app_tmcContactPlugin_show_errors_top', true)): ?>
    <?php foreach($form as $field => $f): ?>
      <?php if($f->hasError()): ?>
        <?php $attributes[$field] = array('class' => 'error') ?>
      <?php endif ?>
    <?php endforeach ?>
    <div class="box_relief red">Certains champs sont incomplets et/ou invalides.</div>
  <?php endif; ?>

  <form id="<?php echo sfConfig::get('app_tmcContactPlugin_contact_form_id', 'contact_form') ?>" method="post" action="<?php echo url_for('@contact') ?>">
    <table>
        <tr>
            <td></td>
            <td><?php echo $form['name']->renderError() ?></td>
        </tr>
        <tr>
            <th><?php echo $form['name']->renderLabel('Nom* :', $attributes['name']) ?></th>
            <td><?php echo $form['name']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['email']->renderError() ?></td>
        </tr>
        <tr>
            <th><?php echo $form['email']->renderLabel('Email* :', $attributes['email']) ?></th>
            <td><?php echo $form['email']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['subject']->renderError() ?></td>
        </tr>
        <tr>
            <th><?php echo $form['subject']->renderLabel('Sujet* :', $attributes['subject']) ?></th>
            <td><?php echo $form['subject']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['message']->renderError() ?></td>
        </tr>
        <tr>
            <th class="message"><?php echo $form['message']->renderLabel('Message* :', $attributes['message']) ?></th>
            <td>
                <?php echo $form['message']->render() ?>
                <?php echo $form->renderHiddenFields() ?>
            </td>
        </tr>
<!--        <tr>
            <td></td>
            <td><?php //echo $form['captcha']->renderError() ?></td>
        </tr>
        <tr>
            <th class="message"><?php //echo $form['captcha']->renderLabel('Captcha* :', $attributes['captcha']) ?></th>
            <td><?php //echo $form['captcha']->render() ?></td>
        </tr>-->
      <tr>
        <td colspan="2">
          <input class="box_relief dark_blue" type="submit" value="Envoyer" />
        </td>
      </tr>
    </table>
  </form>
  <p class="mandatoryInformations">(*) Informations obligatoires</p>
<?php endif; ?>